﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using CAMS.Models;

namespace CAMS.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }

        public IActionResult Index2()
        {
            return View();
        }

        public IActionResult About()
        {
            ViewData["Message"] = "Your application description page.";

            return View();
        }

        public IActionResult Contact()
        {
            ViewData["Message"] = "Your contact page.";

            return View();
        }

        public IActionResult Privacy()
        {
            return View();
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }

        public IActionResult g(string id)
        {
            return View(id);
        }

        public IActionResult getLists()
        {
            List<ad> ads = new List<ad>();
            for (var i = 0; i < 3; i++)
            {
                ad a = new ad() { name="stu："+i , createdatetime=DateTime.Now.ToShortTimeString() };
                ads.Add(a);

            }
            return Json(ads); 
        }
    }
}

class ad
{
    public string id, name, pwd, action, roleNames, roleIds, createdatetime, modifydatetime;
}
